Image processing apparatus and image processing method

ABSTRACT

An image processing apparatus includes a calculation unit configured to calculate a first gain for adjusting brightness of a first image and a second image based on the first image captured at a first exposure amount and the second image captured at a second exposure amount, a division unit configured to divide the first gain into a second gain which changes according to a position in an image and a third gain which does not change according to a position in an image, a first gain correction unit configured to perform gain correction on the second image with the second gain, and a second gain correction unit configured to perform gain correction on the second image with the third gain.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to an image processing apparatus capableof correcting unevenness of exposure amounts.

2. Description of the Related Art

Conventionally, it has been known that variation in opening time andclosing time of a shutter may cause unevenness in an exposure amount ofan image sensor, and correcting such unevenness of the exposure amounthas been requested.

As a method for correcting the unevenness of the exposure amount, forexample, a technique such as discussed in Japanese Patent ApplicationLaid-Open No. 8-154201 has been employed. According to the techniquediscussed in Japanese Patent Application Laid-Open No. 8-154201, a gainis calculated based on an image signal, and a gain of an image signal isadjusted according to that gain. Through this, a gain of an imagecaptured at a different exposure amount can be precisely adjustedaccording to the level of the image signal. In Japanese PatentApplication Laid-Open No. 8-154201, correction of two-dimensionalexposure amount unevenness of the exposure on an imaging plane is nottaken into consideration.

SUMMARY OF THE INVENTION

The present invention is directed to an image processing apparatus andan image processing method capable of correcting two-dimensionalexposure amount unevenness on an imaging plane.

According to an aspect of the present invention, an image processingapparatus includes a calculation unit configured to calculate a firstgain for adjusting brightness of a first image and a second image basedon the first image captured at a first exposure amount and the secondimage captured at a second exposure amount, a division unit configuredto divide the first gain into a second gain which changes according to aposition in an image and a third gain which does not change according toa position in an image, a first gain correction unit configured toperform gain correction on the second image with the second gain, and asecond gain correction unit configured to perform gain correction on thesecond image with the third gain.

Further features of the present invention will become apparent from thefollowing description of exemplary embodiments (with reference to theattached drawings).

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated in and constitute apart of the specification, illustrate exemplary embodiments, features,and aspects of the invention and, together with the description, serveto explain the principles of the invention.

FIG. 1 is a block diagram illustrating a configuration of an imageprocessing apparatus according to a first exemplary embodiment.

FIGS. 2A and 2B are a block diagram and a graph illustrating aconfiguration of a signal processing circuit according to the firstexemplary embodiment.

FIGS. 3A through 3D illustrate gains according to the first exemplaryembodiment.

FIG. 4 is a block diagram illustrating a configuration of a signalprocessing circuit according to a second exemplary embodiment.

FIGS. 5A through 5D illustrate gains according to the second exemplaryembodiment.

FIGS. 6A and 6B are a block diagram and a graph illustrating aconfiguration of an image processing apparatus according to aconventional technique.

DESCRIPTION OF THE EMBODIMENTS

Various exemplary embodiments, features, and aspects of the inventionwill be described in detail below with reference to the drawings.

An image processing apparatus according to a first exemplary embodimentwill be described below with reference to FIG. 1. In FIG. 1, an imageforming optical system 101 includes a lens and the like, and performs azoom adjustment and a focus adjustment by moving back and forth in anoptical axis direction. A shutter 108 performs an exposure timeadjustment by using a time difference in which a leading curtain and atrailing curtain pass through an imaging plane. An image sensor 102 is acharge coupled device (CCD) or the like which converts an optical imageinto an electric signal. An analog-digital (A/D) conversion circuit 103converts an analog image signal from the image sensor 102 into a digitalimage signal. A signal processing unit 104 performs correction of apositional deviation on an image signal output from the A/D conversioncircuit 103. A memory control unit 105 reads and writes image signaldata from/into a memory (dynamic random access memory (DRAM)) 106. Asystem control unit 107 controls operations of the entire imageprocessing apparatus.

The correction of exposure amount unevenness on the imaging planeperformed by the configuration according to Japanese Patent ApplicationLaid-Open No. 8-154201 will be considered. FIG. 6A is a block diagramillustrating an image combining apparatus according to Japanese PatentApplication Laid-Open No. 8-154201. An input image is combined aftergains between two images in different exposure amounts have beenadjusted by a multiplication unit. In the graph in FIG. 6B, a horizontalaxis represents a horizontal position whereas a vertical axis representsa gain as a correction amount. An amount of exposure for an imagemultiplied by the gain is greater. Therefore, the gain is provided insuch a manner that the exposure amount is generally reduced by a valueof 0.3 (i.e., gain-down by 0.3), approximately. This correctioncharacteristic is assumed to have a characteristic configured ofcombination of a gain due to a general difference in exposure amountsbetween two images (0.300), and a gain due to exposure amount unevennessin the horizontal direction (0.297 through 0.301). At this time, if gaincorrection can be performed with respect to a gain range of 0.4% ataccuracy of approximately 8-bit, the gain correction can be performedfaithfully to the calculated gain. However, in such a case, 16-bitaccuracy will be required for the gain correction with respect to thegain range of 100%. In other words, the 16-bit accuracy will be alsorequired for a multiplication unit, so that, with the configurationillustrated in FIG. 6A, a circuit size of the multiplication unit willbe remarkably large.

Therefore, in the present exemplary embodiment, by employing theconfiguration illustrated in FIGS. 2A and 2B, correction of exposureamount unevenness can be realized at high accuracy with a smallercircuit size.

FIG. 2A is a block diagram illustrating a configuration of the signalprocessing unit 104. A first image (overexposed image) captured at afirst exposure amount and a second image (correctly-exposed image)captured at a second exposure amount are input to the signal processingunit 104 as input images. Based on the image signals of the first andthe second images, a gain generation unit 201 calculates a gain (firstgain). Then, the gain generation unit 201 divides the first gain into aGAIN1 (second gain) that changes according to a pixel position in theimage, and a GAIN2 (third gain) that is constant in any pixel position.

A multiplication circuit 202 multiplies the GAIN1, and a multiplicationcircuit 205 multiplies the GAIN2.

A white balance (WB) processing unit 203 analyzes the input images, andperforms conventional white balance processing. According to the presentexemplary embodiment, in order to unify colors of a combined image, thewhite balance processing is performed on the correctly-exposed image andthe overexposed image using the same white balance coefficient.

Flip-flop circuits 206, 207, and 208 perform pipeline processing todivide the multiplication processing of the GAIN1 and the GAIN2.

An image processing unit 209 performs general image processing, such assynchronization processing, matrix transformation processing(development processing), gamma processing, and distortion correctionprocessing, on the input image, and outputs a developed image.

A moving object correction unit 210 corrects a moving object region withrespect to the input image of which the gain of the image signal hasbeen adjusted.

A high dynamic range (HDR) combining unit 211 generates a combined imageby combining the overexposed image and the correctly-exposed image.Hereinbelow, the combined image is referred to as a high dynamic range(HDR) combined image in which a dynamic range is expanded. In addition,processing for combining the overexposed image and the correctly-exposedimage will be referred to as HDR combining processing.

According to the present exemplary embodiment, a dynamic range of a darkportion is expanded by combining the correctly-exposed image and theoverexposed image through the HDR combining processing.

FIGS. 3A through 3D illustrate the GAIN1 calculated by the gaingeneration unit 201 in FIG. 2A.

FIG. 3A is a graph illustrating a relationship of a pixel position and again by the GAIN1, and a horizontal axis represents a horizontalposition whereas a vertical axis represents a gain. According to thepresent exemplary embodiment, the gain by the GAIN1 changes according tothe horizontal position. However, the present invention is not limitedto the above example and may be configured in such a manner that thegain by the GAIN1 changes according to a vertical position or atwo-dimensional pixel position. In order to realize the gain illustratedin FIG. 3A, the multiplication circuit 202 performs multiplicationcalculation expressed by the following equation.

OUT1=IN1×(1−GAIN1/16384)  Equation 1

“OUT1” and “IN1” represent an output and an input of the multiplicationcircuit 202 respectively. The GAIN1 takes a value between 0 through 255.The calculation of the equation 1 is expanded to the following equation.

OUT1=IN1−IN1×(GAIN1/16384)  Equation 2

Accordingly, the multiplication circuit 202 can realize a subtraction at8-bit accuracy and a multiplication at 8-bit accuracy through a bitwiseright shift (14-bit shift).

The multiplication circuit 205 performs multiplication calculationexpressed by the following equation.

OUT2=IN2×(GAIN2/256)  Equation 3

“OUT2” and “IN2” represent an output and an input of the multiplicationcircuit 205 respectively. The GAIN2 takes a value between 0 through 255.Accordingly, the multiplication circuit 205 can realize a multiplicationat 8-bit accuracy through a bitwise right shift (8-bit shift).

The gain generation unit 201 calculates the gain and divides that gaininto a gain of the multiplication circuit 202 and a gain of themultiplication circuit 205 from the equation 0.301=GAIN2/256, andtherefore, the GAIN2 is calculated as 77. Then, the gain is multipliedby both the multiplication circuits 202 and 205, so that a gain range of(77/256)×(1−255/16384) and (77/256)×(1−0/16384), i.e., a gain range of0.296 through 0.301 can be multiplied at 8-bit accuracy. Accordingly, again range and multiplication accuracy equivalent to those illustratedin FIG. 6B can be realized. In addition, the multiplication circuits 202and 205 share the multiplication processing performed through theconfiguration illustrated in FIG. 6A. Therefore, a circuit size for onemultiplication circuit can be smaller, and a difficulty level of thecircuit design can be lowered.

FIG. 3C is a graph illustrating gain adjustment processing for adjustingthe overexposed image to the correctly-exposed image using the gain inFIG. 3A that can be realized by the multiplication circuit 202. Ahorizontal axis represents an object luminance whereas a vertical axisrepresents a pixel value. An image signal 301 is an image signal of thecorrectly-exposed image, an image signal 302 is an image signal of theoverexposed image, and an image signal 303 is a target image signalafter the gain correction. An image signal 304 is an image signal onwhich the gain correction has been performed by the multiplicationcircuit 202, and an image signal 305 is an image signal on which thegain correction has been performed by the multiplication circuit 205.The image signal 305 coincides with the target image signal 303.

On the other hand, FIG. 3D is a graph illustrating the gain adjustmentprocessing for adjusting the overexposed image to the correctly-exposedimage using the gain in FIG. 3B that cannot be realized by themultiplication circuit 202. A horizontal axis represents an objectluminance whereas a vertical axis represents a pixel value. An imagesignal 314 is an image signal on which the gain correction has beenperformed by the multiplication circuit 202, and an image signal 315 isan image signal on which the gain correction has been performed by themultiplication circuit 205. Because the gain in FIG. 3B includes a gainof which value is greater than 1, an image signal in the proximity of asaturated pixel value is deteriorated in the image signal 314. As aresult, the image signal 315 does not coincide with the target imagesignal 303.

Since the multiplication circuit 202 performs the multiplicationcalculation expressed by the equation 1, and the gain of which value isgreater than 1 as illustrated in FIG. 3B is not included, the gaincorrection can be performed without causing the image signal to bedeteriorated.

According to the present exemplary embodiment, the multiplicationcircuit 202 performs the multiplication processing expressed by theequation 1 while the gain correction range is fixed to 0.984 through1.000. However, the present invention is not limited to the aboveexample, and the gain correction range may be changed as necessary. Forexample, the gain correction may be performed by shifting the gaincorrection range among a case of an equation 4 indicated below, a caseof the equation 1, and a case of no gain correction, as appropriate.

OUT1=IN1×(1−GAIN1/4096)  Equation 4

By employing the equation 4, the correction can be performed with awider gain correction range of 0.938 through 1.000.

For example, the level of exposure amount unevenness generatedtwo-dimensionally on the imaging plane may change depending on variationin time in which the leading curtain and the trailing curtain passthrough the imaging plane. In a case where the left side of the leadingcurtain passes through the imaging plane later than the right sidethereof, for example, the exposure time on the left side thereof will beshorter for the period being late, and thus the exposure amount on theleft side of the imaging plane will be less than that on the right sidethereof. In addition, if variation in time is a comparable level, theinfluence from the variation in time becomes greater when the exposuretime is shorter, so that the level of two-dimensional exposure amountunevenness becomes worse for the case with shorter exposure time thanfor the case with longer exposure time.

Therefore, in a case where the exposure time of the input image withless exposure amount is shorter than a certain threshold value, theequation 4 with wider gain correction range is selected because thetwo-dimensional exposure amount unevenness will be changedsignificantly. On the contrary, in a case where the exposure time islonger than a certain threshold value, the two-dimensional exposureamount unevenness changes gradually. Thus, the correction level of thetwo-dimensional exposure amount unevenness may be limited by selectingthe equation 1 with sensitive gain correction accuracy. Furthermore, ifthe exposure time thereof is sufficiently long, the no gain correctionmay be selected.

In addition, the multiplication processing of the multiplication circuit202 may be performed by an equation 5 indicated below, so that thecorrection level of the two-dimensional exposure amount unevenness islimited by making a value “α” smaller when the exposure time of theinput image with less exposure amount is longer.

OUT1=IN1×(1−(α×GAIN1)/4096)  Equation 5

“α” is a value between 0 through 1.

In addition, instead of changing the processing according to theexposure time of the input image with less exposure amount, thecorrection level of the two-dimensional exposure amount unevenness maybe limited when a difference between two exposure times is smaller.

The moving object correction unit 210 detects a region where a movingobject image is formed by calculating a pixel difference value of twoimages of which image signals are subjected to gain adjustment by themultiplication circuits 202 and 205. A region of which difference valueis greater than a predetermined value is regarded as a moving objectregion, so that the image signal of the image with greater exposureamount is replaced with the image signal of the image with less exposureamount. A region of which difference value is less than thepredetermined value is regarded not as a moving object region, so thatthe image signal of the image with greater exposure amount is applied asit is, and an image signal of a region therebetween is replaced with animage signal obtained from a weighted addition of image signals of thetwo images. In this manner, the moving object region detected in theimage with greater exposure amount is corrected. Through theabove-described moving object correction processing, a position of themoving object captured in the image with greater exposure amount can beadjusted to a position of the same moving object captured in the imagewith less exposure amount without causing overexposure of the movingobject image.

As illustrated in FIG. 2B, the HDR combining unit 211 outputs the imagesignal of the correctly-exposed image with less exposure amount as it isin a bright region and outputs the image signal of the overexposed imagewith greater exposure amount in a dark region. Further, the HDRcombining unit 211 outputs the image signal obtained from a weightedaddition of the image signals of the two images in a region other thanthe above-described regions. Accordingly, the HDR combining unit 211 cangenerate an image with a wide dynamic range.

As described above, according to the present exemplary embodiment, thegain for adjusting the exposure amount is divided into the GAIN1 whichchanges according to a pixel position and the GAIN2 which is constantfor any pixel position. Then, the image signal of the input image withdifferent exposure amount is multiplied by the GAIN1 and the GAIN2,respectively. Accordingly, the two-dimensional exposure amountunevenness on the imaging plane can be corrected by a smaller sizecircuit.

According to the present exemplary embodiment, combining processing bythe HDR combining unit 211 is performed on the developed image that isoutput after going through the processing by the image processing unit209. However the present invention is not limited to the above example,and the combining processing may be executed on the image before goingthrough the processing by the image processing unit 209, especiallybefore the development processing.

Further, according to the present exemplary embodiment, the HDRcombining processing is performed using two images such as theoverexposed image and the correctly-exposed image. However, the HDRcombining processing may be performed by generating three or more imageswith different exposure. In such a case, a gain based on an image withthe lowest exposure may be set to the other images with differentexposure.

An image processing apparatus according to a second exemplary embodimentof the present invention will be described below with reference toFIG. 1. The image processing apparatus according to the second exemplaryembodiment is similar to the image processing apparatus according to thefirst exemplary embodiment except for the signal processing circuit 104.

FIG. 4 is a block diagram illustrating a configuration of the signalprocessing circuit 104. The signal processing circuit 104 according tothe second exemplary embodiment is similar to the signal processingcircuit 104 according to the first exemplary embodiment except for amultiplication circuit 402 and a multiplication circuit 405.

According to the present exemplary embodiment, a dynamic range of abright portion is expanded by combining a correctly-exposed image and anunderexposed image through HDR combining processing.

FIGS. 5A through 5D are graphs illustrating the GAIN1.

FIG. 5A is a graph illustrating a relationship of a pixel position and again by the GAIN1, and a horizontal axis represents a horizontalposition whereas a vertical axis represents a gain. According to thepresent exemplary embodiment, the gain by the GAIN1 changes according tothe horizontal position. However, the present invention is not limitedto the above example, and the gain by the GAIN1 may change according toa vertical position or a two-dimensional pixel position. In order torealize the gain illustrated in FIG. 5A, the multiplication circuit 402performs multiplication calculation expressed by the following equation.

OUT1=IN1×(1+GAIN1/16384)  Equation 6

“OUT1” and “IN1” represent an output and an input of the multiplicationcircuit 402 respectively. The GAIN1 takes a value between 0 through 255.The calculation of the equation 6 is expanded to the following equation.

OUT1=IN1+IN1×(GAIN1/16384)  Equation 7

Accordingly, the multiplication circuit 402 can realize an addition at8-bit accuracy and a multiplication at 8-bit accuracy through a bitwiseright shift (14-bit shift).

The multiplication circuit 405 performs multiplication calculationexpressed by the following equation.

OUT2=IN2×(GAIN2/64)  Equation 8

“OUT2” and “IN2” represent an output and an input of the multiplicationcircuit 405 respectively. The GAIN2 takes a value between 0 through 255.Accordingly, the multiplication circuit 405 can realize a multiplicationat 8-bit accuracy through a bitwise right shift (6-bit shift). Accordingto the present exemplary embodiment, a difference in values between theexposure amount of the underexposed image and the exposure amount of thecorrectly-exposed image is set to be less than fourfold the value.Therefore, a gain range of the multiplication circuit 405 is set to be(0/64) through (255/64), i.e., 0.0 through 3.9. However, the presentinvention is not limited to this gain range and may be configured tocover a wider gain range according to a required exposure difference.

The gain generation unit 201 divides a gain required for correctionprocessing into a gain of the multiplication circuit 402 and a gain ofthe multiplication circuit 405. For example, if the gain of themultiplication circuit 405 is 3.3, from the equation 3.3=GAIN2/64, theGAIN2 is calculated as 211. Therefore, the gain is multiplied by boththe multiplication circuits 402 and 405, and thus, a gain range of(211/64)×(1+0/16384) through (211/64)×(1+255/16384), i.e., a gain rangeof 3.297 through 3.348 can be multiplied at 8-bit accuracy. Accordingly,in the similar manner to the first exemplary embodiment, an exposureamount unevenness component generated two-dimensionally can be preciselycorrected at 8-bit accuracy. Further, because the multiplicationcircuits 402 and 405 share and perform the multiplication processing, acircuit size for one multiplication circuit can be smaller, and as inthe similar manner to the first exemplary embodiment, a difficulty levelof the circuit design can be lowered.

FIG. 5C is a graph illustrating gain adjustment processing for adjustingthe underexposed image to the correctly-exposed image using the gain inFIG. 5A that can be realized by the multiplication circuit 402. Ahorizontal axis represents an object luminance whereas a vertical axisrepresents a pixel value. An image signal 501 is an image signal of thecorrectly-exposed image, an image signal 502 is an image signal of theunderexposed image, and an image signal 503 is a target image signalafter the gain correction. An image signal 504 is an image signal onwhich the gain correction has been performed by the multiplicationcircuit 402, and an image signal 505 is an image signal on which thegain correction has been performed by the multiplication circuit 405.The image signal 505 coincides with the target image signal 503.

On the other hand, FIG. 5D is a graph illustrating the gain adjustmentprocessing for adjusting the underexposed image to the correctly-exposedimage using the gain in FIG. 5B that cannot be realized by themultiplication circuit 402. A horizontal axis represents an objectluminance whereas a vertical axis represents a pixel value. An imagesignal 514 is an image signal on which the gain correction has beenperformed by the multiplication circuit 402, and an image signal 515 isan image signal on which the gain correction has been performed by themultiplication circuit 405. The gain in FIG. 5B includes a gain of whichvalue is less than 1. Therefore, a round-off error of the multiplicationbecomes unnecessary large in the image signal 514. As a result, althoughthe image signal 515 mostly coincides with the target image signal 503,the round-off error thereof becomes unnecessary large.

The multiplication calculation of the multiplication circuit 402 isexpressed by the equation 6, and the gain of which value is less than 1as illustrated in FIG. 5B is not included. Therefore, the gaincorrection can be performed without causing the round-off error to beunnecessary large.

As described above, according to the present exemplary embodiment, thegain for adjusting the exposure amount is divided into the GAIN1 whichchanges according to a pixel position and the GAIN2 which is constantfor any pixel position. Then, the image signal of the input image withdifferent exposure amount is multiplied by the GAIN1 and the GAIN2,respectively. Accordingly, the two-dimensional exposure amountunevenness on the imaging plane can be corrected by a smaller sizecircuit.

Further, according to the present exemplary embodiment, HDR combiningprocessing is performed using two images such as the underexposed imageand the correctly-exposed image. However, the HDR combining processingmay be performed by generating three or more images with differentexposure. In such a case, a gain based on an image with the highestexposure may be set to the other images with different exposure.

Other Embodiments

Embodiments of the present invention can also be realized by a computerof a system or apparatus that reads out and executes computer executableinstructions recorded on a storage medium (e.g., non-transitorycomputer-readable storage medium) to perform the functions of one ormore of the above-described embodiment(s) of the present invention, andby a method performed by the computer of the system or apparatus by, forexample, reading out and executing the computer executable instructionsfrom the storage medium to perform the functions of one or more of theabove-described embodiment(s). The computer may comprise one or more ofa central processing unit (CPU), micro processing unit (MPU), or othercircuitry, and may include a network of separate computers or separatecomputer processors. The computer executable instructions may beprovided to the computer, for example, from a network or the storagemedium. The storage medium may include, for example, one or more of ahard disk, a random-access memory (RAM), a read only memory (ROM), astorage of distributed computing systems, an optical disk (such as acompact disc (CD), digital versatile disc (DVD), or Blu-ray Disc (BD)™),a flash memory device, a memory card, and the like.

While the present invention has been described with reference toexemplary embodiments, it is to be understood that the invention is notlimited to the disclosed exemplary embodiments. The scope of thefollowing claims is to be accorded the broadest interpretation so as toencompass all such modifications and equivalent structures andfunctions.

This application claims priority from Japanese Patent Application No.2012-101671 filed Apr. 26, 2012, which is hereby incorporated byreference herein in its entirety.

What is claimed is:
 1. An image processing apparatus comprising: acalculation unit configured to calculate a first gain for adjustingbrightness of a first image and a second image based on the first imagecaptured at a first exposure amount and the second image captured at asecond exposure amount; a division unit configured to divide the firstgain into a second gain which changes according to a position in animage and a third gain which does not change according to a position inthe image; a first gain correction unit configured to perform gaincorrection on the second image with the second gain; and a second gaincorrection unit configured to perform gain correction on the secondimage with the third gain.
 2. An image processing apparatus comprising:a calculation unit configured to calculate a gain which changesaccording to a position in an image and another gain which does notchange according to a position in the image for adjusting brightness ofa first image and a second image based on the first image captured at afirst exposure amount and the second image captured at a second exposureamount; a first gain correction unit configured to perform gaincorrection on the second image with the gain which changes according toa position in the image; and a second gain correction unit configured toperform gain correction on the second image with the another gain whichdoes not change according to a position in the image.
 3. The imageprocessing apparatus according to claim 1, wherein the second exposureamount is greater than the first exposure amount, and wherein thedivision unit divides the first gain into the second gain and the thirdgain so that the second gain is less than
 1. 4. The image processingapparatus according to claim 1, wherein the second exposure amount isless than the first exposure amount, and wherein the division unitdivides the first gain into the second gain and the third gain so thatthe second gain is greater than
 1. 5. The image processing apparatusaccording to claim 1, wherein the first exposure amount and the secondexposure amount differ in exposure time, and a level of gain correctionperformed by the first gain correction unit is controlled according to asmaller exposure amount of the first exposure amount and the secondexposure amount.
 6. The image processing apparatus according to claim 2,wherein the first exposure amount and the second exposure amount differin exposure time, and a level of gain correction performed by the firstgain correction unit is controlled according to a smaller exposureamount of the first exposure amount and the second exposure amount. 7.The image processing apparatus according to claim 1, wherein the firstexposure amount and the second exposure amount differ in exposure time,and a level of gain correction performed by the first gain correctionunit is controlled according to a difference between the first exposureamount and the second exposure amount.
 8. The image processing apparatusaccording to claim 2, wherein the first exposure amount and the secondexposure amount differ in exposure time, and a level of gain correctionperformed by the first gain correction unit is controlled according to adifference between the first exposure amount and the second exposureamount.
 9. The image processing apparatus according to claim 1, furthercomprising: a detection unit configured to detect a moving object regionof an image with a greater exposure amount of the first image amount andthe second image amount; and a correction unit configured to replace themoving object region with an image with a smaller exposure amount of thefirst image and the second image.
 10. The image processing apparatusaccording to claim 2, further comprising: a detection unit configured todetect a moving object region of an image with a greater exposure amountof the first image amount and the second image amount; and a correctionunit configured to replace the moving object region with an image with asmaller exposure amount of the first image and the second image.
 11. Theimage processing apparatus according to claim 1, further comprising acombining unit configured to generate an image with a wide dynamic rangeby combining the first image and the second image, wherein, according tobrightness of each region in the first image, the combining unit outputsany of the first image, the second image, and an image generated from aweighted addition of the first image and the second image as a combinedimage of each region.
 12. The image processing apparatus according toclaim 2, further comprising a combining unit configured to generate animage with a wide dynamic range by combining the first image and thesecond image, wherein, according to a brightness of each region in thefirst image, the combining unit outputs any of the first image, thesecond image, and an image generated from a weighted addition of thefirst image and the second image as a combined image of each region. 13.An image capturing apparatus comprising: a calculation unit configuredto calculate a first gain for adjusting brightness of a first image anda second image based on the first image captured at a first exposureamount and the second image captured at a second exposure amount; adivision unit configured to divide the first gain into a second gainwhich changes according to a position in an image and a third gain whichdoes not change according to a position in the image; a first gaincorrection unit configured to perform gain correction on the secondimage with the second gain; a second gain correction unit configured toperform gain correction on the second image with the third gain; animage capturing unit; and a control unit configured to control anexposure amount by controlling an exposure time of the image capturingunit.
 14. An image capturing apparatus comprising: a calculation unitconfigured to calculate a gain which changes according to a position inan image and another gain which does not change according to a positionin the image for adjusting brightness of a first image and a secondimage based on the first image captured at a first exposure amount andthe second image captured at a second exposure amount; a first gaincorrection unit configured to perform gain correction on the secondimage with the gain which changes according to a position in the image;and a second gain correction unit configured to perform gain correctionon the second image with the another gain which does not changeaccording to a position in the image; an image capturing unit; and acontrol unit configured to control an exposure amount by controlling anexposure time of the image capturing unit.
 15. A method for performingimage processing, the method comprising: calculating a first gain foradjusting brightness of a first image and a second image based on thefirst image captured at a first exposure amount and the second imagecaptured at a second exposure amount; dividing the first gain into asecond gain which changes according to a position in an image and athird gain which does not change according to a position in the image;performing first gain correction on the second image with the secondgain; and performing second gain correction on the second image with thethird gain.
 16. A method for performing image processing, the methodcomprising: calculating a gain which changes according to a position inan image and another gain which does not change according to a positionin the image for adjusting brightness of a first image and a secondimage based on the first image captured at a first exposure amount andthe second image captured at a second exposure amount; performing firstgain correction on the second image with the gain which changesaccording to a position in the image; and performing second gaincorrection on the second image with the another gain which does notchange according to a position in the image.
 17. A computer executableprogram describing a procedure for a method according to claim
 15. 18. Acomputer executable program describing a procedure for a methodaccording to claim
 16. 19. A computer readable storage medium storing aprogram for causing a computer to execute each step of a methodaccording to claim
 15. 20. A computer readable storage medium storing aprogram for causing a computer to execute each step of a methodaccording to claim 16.